<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>书籍列表</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<h3>书籍列表</h3>
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
        <a href="/book/book_add/" class="btn btn-primary">添加书籍</a>
            <table class="table table-striped table-hover">  <!-- striped为斑马线，hover为悬浮效果，就这几个属性，记住它吧. -->
                <thead>
                <tr>
                    <th>编号</th>
                    <th>书籍名称</th>
                    <th>价格</th>
                    <th>出版日期</th>
                    <th>出版社</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {% for book in book_list %}
                    <tr>
                        <td>{{ book.nid }}</td>
                        <td>{{ book.title }}</td>
                        <td>{{ book.price }}</td>
                        <td>{{ book.pub_date|date:'Y-m-d'}}</td>
                        <td>{{ book.publisher }}</td>
                    <td>
{#                        <a href="/books/edit/{{ book.nid }}" class="btn btn-warning btn-sm">编辑</a>#}
                        <a href="{% url 'book_edit' book.nid %}" class="btn btn-warning btn-sm">编辑</a>
                        <a href="/book/book_del/{{ book.nid }}/" class="btn btn-danger btn-sm">删除</a>
                    </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>

</body>
</html>